package org.example.xiaomi.vo;

import lombok.Data;

@Data
public class ResultVO <T>{
    private int code;
    private String msg;
    private T data;
    private long count;
    private ResultVO(int code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }
    private ResultVO(int code, String msg, T data, long count) {
        this.code = code;
        this.msg = msg;
        this.data = data;
        this.count = count;
    }
    public static <T> ResultVO<T> success(T data) {
        return new ResultVO<T>(0, "success", data);
    }
    public static <T> ResultVO<T> success(T data, long count) {
        return new ResultVO<T>(0, "success", data, count);
    }
    public static <T> ResultVO<T> fail(String msg) {
        return new ResultVO<T>(1, msg, null);
    }
}
